import Vue from 'vue'
import Vuex from 'vuex'

// 持久化插件
// 如果用cookie js-cookie库
import createPersistedstate from 'vuex-persistedstate'

import common from './common'
import user from './modules/user'

Vue.use(Vuex)

const store = new Vuex.Store({
  ...common,
  modules: {
    user,
  },
  plugins: [
    createPersistedstate({
      key: 'abc',
      // 当前你要存储哪些模块持久化
      paths: ['user'],
      // paths: ['city'],
      storage: window.sessionStorage
    })
  ]
})

export default store
